﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using QC;
using ReportsClassLibrary;
using SchedulesClassLibrary;


namespace WCF_QC
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
 
    public class Service1 : IService1
    {

        //------------- From Measurements Class  

        Measurement ms = new Measurement(); //classes not in solution yet so can't actually call them
        //Order ord = new Ordered();
        Report rpt = new Report();
        MachineSchedule mchsch = new MachineSchedule();

        //---------- From Login Class
       // Login login = new Login();

     [OperationBehavior]
        public DataTable ListofMaterialsScheduled()
        {
            DataTable listofmaterials = new DataTable();
            return listofmaterials = ms.ListofMaterialsScheduled();
        }

        //display gets measurements by for each material by materialid

        public DataTable DisplayRequiredMeasurements(int materialID)
        {
            DataTable requiredmeasurements = new DataTable();
            return requiredmeasurements = ms.DisplayRequiredMeasurements(materialID);
       
        }

        //takes input from measurements screen and sends it to the Measurements DB


       
           public string GetMeasurementsTaken_table(DataTable table)
        {
            string results = "";
            return results = ms.GetMeasurementsTaken_table(table);
        }

        public string GetMeasurementsTaken(decimal measurement, int orderID, int materialattribID, int materialID)
        {
            string results = "";
            return results = ms.GetMeasurementsTaken(measurement, orderID, materialattribID, materialID);
        }


        //---------- From Orders Class 

        //public DataTable GetCurrentDayOrders(DateTime StartDate, DateTime EndDate)
        //{
        //    DataTable currentorders = new DataTable();
        //    return currentorders = ord.GetCurrentDayOrders(StartDate, EndDate);
        //}


        //public DataTable GetFutureOrders(DateTime StartDate, DateTime EndDate)
        //{
        //    DataTable futureorders = new DataTable();
        //    return futureorders = ord.GetFutureOrders(StartDate, EndDate);

        //}

        //----------From Reports Class
        public List<Report> GetReportData(DateTime startDate, DateTime endDate, string type)    
        {
            List<Report> getreports = new List<Report>();
            getreports = rpt.GetReportData(startDate, endDate, type);
            return getreports;

        }

        //public DataTable allReportData()    //unsure of data type and variable to pass here
        //{
        //    DataTable allreports = new DataTable();
        //    return allreports = rpt.GetReportData();
        //}


        //---------From MachineSchedule Class
        public List<MachineSchedule> GetScheduleData()
        {
            List<MachineSchedule> getschedule = new List<MachineSchedule>();
            return getschedule = mchsch.GetMachinesRunning();
        }

        public List<MachineSchedule> TestScheduleData()
        {
            List<MachineSchedule> testSchedule = new List<MachineSchedule>();
            return testSchedule = mchsch.GetCurrentShift();
        }

        public List<MachineSchedule> TeamStatusData()
        {
            List<MachineSchedule> teamStatus = new List<MachineSchedule>();
            return teamStatus = mchsch.GetAllShifts();
        }

        public List<MachineSchedule> SingleMachineRunning(int MachnID)
        {
            List<MachineSchedule> singleMachine = new List<MachineSchedule>();
            return singleMachine = mchsch.SingleMachineRunning(MachnID);
        }



        //--------From Login Class

        //public bool LoginUser()
        //{
        //    bool userResult = new bool();
        //    return userResult = login.LoginUser();
        //}

        //public DataTable DisplaySession()
        //{
        //    DataTable sessionDataTable = new DataTable();
        //    return sessionDataTable = login.DisplaySession();
        //}







        //public string GetData(int value)
        //{
        //    return string.Format("You entered: {0}", value);
        //}

        //public CompositeType GetDataUsingDataContract(CompositeType composite)
        //{
        //    if (composite == null)
        //    {
        //        throw new ArgumentNullException("composite");
        //    }
        //    if (composite.BoolValue)
        //    {
        //        composite.StringValue += "Suffix";
        //    }
        //    return composite;
        //}
    }
}
